
import { staticRoutes } from '../../router/staticRoutes';


/**
 * 本地路由过滤排序
 */
function localFilterAsyncRouter(asyncRouterMap) {
  const Router = asyncRouterMap.filter((item, index) => {
    if (item.order) {
      return true
    }
  })

  Router.sort((a, b) => {
    return parseInt(a.order) - parseInt(b.order);
  });

  return Router
}

// console.log('路由排序', localFilterAsyncRouter(staticRoutes));


const state = {
  routes: localFilterAsyncRouter(staticRoutes),
}
const mutations = {
  SET_ROUTER: (state: any, routes: any) => {
    state.routes = routes;
  },
}
const actions = {
}
const getters = {
}
const modules = {
}


export default {
  namespaced: true,
  state,
  mutations,
  actions
}

